﻿/*
    Project: IV:MP GUI Editor (http://code.google.com/p/ivmp-gui-editor)
    Code license: GNU Lesser GPL (http://www.gnu.org/copyleft/lesser.html) 
 */

using ICSharpCode.AvalonEdit.CodeCompletion;
using System.Collections.ObjectModel;

namespace IvmpEditor
{
    public class CIvmpFunctions : ICodeCompletion
    {
        public string Title { get { return "IV:MP RC3 Functions"; } }
        ObservableCollection<ICompletionData> m_functions;
        public override ObservableCollection<ICompletionData> CompletionsList
        {
            get
            {
                if (m_functions == null)
                    m_functions = new ObservableCollection<ICompletionData>()
    {
        // Constants:
        new CodeCompletionItem("MAX_PLAYERS", "int", CodeCompletionItem.NOT_FUNCTION,
            "A limit for players count on this server, set by server config."),
        new CodeCompletionItem("MAX_VEHICLES", "int", CodeCompletionItem.NOT_FUNCTION,
            "A limit for vehicles on server."),
        new CodeCompletionItem("MAX_OBJECTS", "int", CodeCompletionItem.NOT_FUNCTION,
            "A limit for objects."),
        new CodeCompletionItem("MAX_CHECKPOINTS", "int", CodeCompletionItem.NOT_FUNCTION,
            "A limit for checkpoints."),
        new CodeCompletionItem("MAX_BLIPS", "int", CodeCompletionItem.NOT_FUNCTION,
            "A limit for blips."),
        new CodeCompletionItem("MAX_ACTORS", "int", CodeCompletionItem.NOT_FUNCTION,
            "A limit for actors."),
        new CodeCompletionItem("MAX_NAME_LENGTH", "int", CodeCompletionItem.NOT_FUNCTION,
            "A limit for player name length."),
        new CodeCompletionItem("INVALID_PLAYER_ID", "int", CodeCompletionItem.NOT_FUNCTION,
            ""),
        new CodeCompletionItem("INVALID_VEHICLE_ID", "int", CodeCompletionItem.NOT_FUNCTION,
            ""),
        new CodeCompletionItem("INVALID_OBJECT_ID", "int", CodeCompletionItem.NOT_FUNCTION,
            ""),
        new CodeCompletionItem("INVALID_ACTOR_ID", "int", CodeCompletionItem.NOT_FUNCTION,
            ""),
        new CodeCompletionItem("INVALID_CHECKPOINT_ID", "int", CodeCompletionItem.NOT_FUNCTION,
            ""),
        new CodeCompletionItem("INVALID_BLIP_ID", "int", CodeCompletionItem.NOT_FUNCTION,
            ""),
        new CodeCompletionItem("INVALID_PICKUP_ID", "int", CodeCompletionItem.NOT_FUNCTION,
            ""),
        new CodeCompletionItem("IVMP_VERSION", "string", CodeCompletionItem.NOT_FUNCTION,
            ""),

        // "Server functions"
        new CodeCompletionItem("log", "bool", "(string text)",
            "Outputs a line to the console and log file."),
        new CodeCompletionItem("sendConsoleInput", "bool", "(string text)",
            "Sends a console input (calls consoleInput event). Returns true, if the input was set."),
        new CodeCompletionItem("addRule", "bool", "(string rule, string value)",
            "Adds a server rule with value."),
        new CodeCompletionItem("setRule", "bool", "(string rule, string value)",
            "Sets the new value for server rule. Returns false if failed."),
        new CodeCompletionItem("getRule", "string", "(string rule)",
            "Gets the value for server rule. Returns false if failed."),
        new CodeCompletionItem("removeRule", "bool", "(string rule)",
            "Removes a server rule. Returns false if failed."),
        new CodeCompletionItem("shutdown", CodeCompletionItem.NO_RETURN, CodeCompletionItem.NO_ARGS,
            "Shuts down server."),
        new CodeCompletionItem("getServerPassword", "string", CodeCompletionItem.NO_ARGS,
            "Returns the current server password string. If no password set, returns \"None\" string."),
        new CodeCompletionItem("setServerPassword", "bool", "(string password)",
            "Sets the new server password. Returns true if succeeded."),
        new CodeCompletionItem("getPlayerCount", "int", CodeCompletionItem.NO_ARGS,
            "Gets the current amount of players on the server."),
        new CodeCompletionItem("getPlayerSlots", "int", CodeCompletionItem.NO_ARGS,
            "Returns the maximum count of players allowed by server config."),
        //new CodeCompletionItem("getPlayers", "table", CodeCompletionItem.NO_ARGS,
        //    "Returns the table containing all players."),
        //new CodeCompletionItem("turns a table consisting of server settings.", "table", CodeCompletionItem.NO_ARGS,
        //    "Returns the table consisting of server settings."),
        new CodeCompletionItem("getTickCount", "int", CodeCompletionItem.NO_ARGS, 
            "Returns the current server tickcount."),
        new CodeCompletionItem("setHostname", "bool", "(string hostname)", 
            "Sets the server's hostname string."),
        new CodeCompletionItem("getHostname", "string", CodeCompletionItem.NO_ARGS, 
            "Gets the server's hostname string."),
        new CodeCompletionItem("getWeaponName", "string", "(int weaponModelId)", 
            "Gets the name of weapon by it's model id, returns false, if incorrect weapon model id was specified."),
        new CodeCompletionItem("togglePayAndSpray", "bool", "(bool toggle)", 
            "Toggles if everybody is able to use Pay&Spray."),
        new CodeCompletionItem("toggleAutoAim", "bool", "(bool toggle)", 
            "Toggles if everybody is able to use AutoAim."),
        new CodeCompletionItem("toggleFrequentEvents", "bool", "(bool toggle)", 
            "Toggles frequent scripting events."),
        new CodeCompletionItem("areFrequentEventsEnabled", "bool", CodeCompletionItem.NO_ARGS,
            "Returns true if frequent events are enabled by server config, false otherwise."),

        // "Player functions"
        new CodeCompletionItem("isPlayerConnected", "bool", "(int playerid)", 
            "Checks if a player with specified ID is connected to the server."),
        new CodeCompletionItem("isPlayerSpawned", "bool", "(int playerid)", 
            "Checks if a player is spawned."),
        new CodeCompletionItem("isPlayerOnFoot", "bool", "(int playerid)", 
            "Checks if a player is on foot"),
        new CodeCompletionItem("isPlayerInAnyVehicle", "bool", "(int playerid)", 
            "Checks if a player is in any vehicle."),
        new CodeCompletionItem("setPlayerSpawnLocation", "bool", "(int playerid, float x, float y, float z, float heading)", 
            "Sets the location and heading for a player, which will be used as spawn location."),
        new CodeCompletionItem("setPlayerCoordinates", "bool", "(int playerid, float x, float y, float z)", 
            "Teleports a player to specified coordinates."),
        new CodeCompletionItem("getPlayerCoordinates", "array", "(int playerid)", 
            "Gets the table with player coordinates, returns false if failed."),
        new CodeCompletionItem("setPlayerName", "bool", "(int playerid, string name)", 
            "Sets the new name for a player. Returns true if succeeded."),
        new CodeCompletionItem("getPlayerName", "string", "(int playerid)", 
            "Gets the player name. Returns false, if failed."),
        new CodeCompletionItem("setPlayerHealth", "bool", "(int playerid, int health)", 
            "Sets the player health."),
        new CodeCompletionItem("getPlayerHealth", "int", "(int playerid)", 
            "Gets the health of a specified player, returns false if failed."),
        new CodeCompletionItem("setPlayerArmour", "bool", "(int playerid, int armour)", 
            "Sets the player's armour (0-100)."),
        new CodeCompletionItem("getPlayerArmour", "int", "(int playerid)", 
            "Gets the player's armour, returns false if failed."),
        new CodeCompletionItem("setPlayerHeading", "bool", "(int playerid, float heading)", 
            "Sets the player's z-rotation angle (heading)."),
        new CodeCompletionItem("getPlayerHeading", "float", "(int playerid)", 
            "Gets the player's z-rotation angle (heading)."),
        new CodeCompletionItem("setPlayerModel", "bool", "(int playerid, int modelId)", 
            "Sets the player model (skin id), returns false if failed."),
        new CodeCompletionItem("getPlayerModel", "int", "(int playerid)", 
            "Gets the player model (skin id), returns false if failed."),
        new CodeCompletionItem("setPlayerDimension", "bool", "(int playerid, int dimension)", 
            "Moves a player into dimension (0-254), returns false if failed."),
        new CodeCompletionItem("getPlayerDimension", "int", "(int playerid)", 
            "Gets they dimension id of a player."),
        new CodeCompletionItem("setPlayerClothes", "bool", "(int playerid, int bodyPart, int clothes)", 
            "Changes player clothes with bodyPart(0-10) and clothes id."),
        new CodeCompletionItem("getPlayerClothes", "array", "(int playerid)", 
            "Returns the array with player's clothes."),
        new CodeCompletionItem("setPlayerColor", "bool", "(int playerid, int rgbaColor)", 
            "Changes player's color (RGBA HEX 0x***)."),
        new CodeCompletionItem("getPlayerColor", "int", "(int playerid)", 
            "Gets the color of a player."),
        //new CodeCompletionItem("setPlayerInterior", "bool", "(int playerid, int interior)", 
         //   "Moves a player into interior."),
        //new CodeCompletionItem("getPlayerInterior", "int", "(int playerid)", 
         //   "Gets the interior id of a specified player. Returns false if failed."),
        new CodeCompletionItem("setPlayerMoney", "bool", "(int playerid, int money)", 
            "Sets the player's money."),
        new CodeCompletionItem("getPlayerMoney", "int", "(int playerid)", 
            "Gets the money of a player. Returns false if failed."),
        new CodeCompletionItem("givePlayerMoney", "bool", "(int playerid, int amount)", 
            "Gives an amount of money to a player."),
        new CodeCompletionItem("resetPlayerMoney", "bool", "(int playerid)", 
            "Sets the money of a player to zero."),
        new CodeCompletionItem("setPlayerVelocity", "bool", "(int playerid, float xvel, float yvel, float zvel)", 
            "Sets the velocity of a player (move speed)."),
        new CodeCompletionItem("getPlayerVelocity", "array", "(int playerid)", 
            "Gets the velocity of a player (move speed), returns false if failed."),
        new CodeCompletionItem("setPlayerWantedLevel", "bool", "(int playerid, int wantedLevel)", 
            "Sets the fake wanted level for a player."),
        new CodeCompletionItem("getPlayerWantedLevel", "int", "(int playerid)", 
            "Gets the player's wanted level, returns false if failed."),
        new CodeCompletionItem("setPlayerTime", "bool", "(int playerid, int hour, int minute)", 
            "Sets the time of the day for a player."),
        //new CodeCompletionItem("setPlayerGravity", "bool", "(int playerid, float gravity)", 
            //"Sets player gravity."),
        new CodeCompletionItem("setPlayerWeather", "bool", "(int playerid, int weather)", 
            "Sets the weather id for a player."),
        new CodeCompletionItem("setPlayerDucking", "bool", "(int playerid, bool ducking)", 
            "Forces a player to crouch, or makes player stand up."),
        new CodeCompletionItem("setPlayerInvincible", "bool", "(int playerid, bool invincible)", 
            "Sets the invincible option for a player. Invincible = true means godmode."),
        new CodeCompletionItem("setPlayerCameraPos", "bool", "(int playerid, float x, float y, float z)", 
            "Sets the location for a player camera."),
        new CodeCompletionItem("setPlayerCameraLookAt", "bool", "(int playerid, float x, float y, float z)", 
            "Sets the location of a player camera's look-at point."),
        new CodeCompletionItem("resetPlayerCamera", "bool", "(int playerid)", 
            "Resets the player camera (sets to behind)"),
        new CodeCompletionItem("attachPlayerCameraToPlayer", "bool", "(int playerid, int toPlayerId)", 
            "Attachs the player's camera to another player's camera, returns false if failed."),
        new CodeCompletionItem("attachPlayerCameraToVehicle", "bool", "(int playerid, int toVehicleId)", 
            "Attachs the player's camera to a vehicle, returns false if failed."),
        // TODO

    };

                return m_functions;
            }
        }
    }
}
